package cc.minos.components.scrollbar
{
	import flash.display.DisplayObjectContainer;
	import flash.display.InteractiveObject;
	
	/**
	 * ...
	 * @author Minos
	 */
	public class DefaultScrollBar extends ScrollBar
	{
		private var skin:DisplayObjectContainer;
		
		public function DefaultScrollBar( skin:DisplayObjectContainer , length:Number = 100 , direction:String = VERTICAL )
		{
			
			
			this.skin = skin;
			
			thumb = skin.getChildByName( "thumb" ) as InteractiveObject;
			track = skin.getChildByName( "track" ) as InteractiveObject;
			
			btnUp = skin.getChildByName( "btnUp" ) as InteractiveObject;
			btnDown = skin.getChildByName( "btnDown" ) as InteractiveObject;
			
			if ( !thumb || !track || !btnUp || !btnDown )
			{
				trace( "scroll skin wrong!!" );
				//return;
			}
			
			track.height = length - btnUp.height - btnDown.height;
			track.y = btnUp.height;
			thumb.y = btnUp.height;
			btnDown.y = length-btnDown.height;
			
			addChild( skin );
			
			super();
		}
		
		public function update():void
		{
			setSize( sizeRatio );
		}
	
	}

}